<?php
require('common.php');

if (!empty($G['table']))
{
	// check to see if this table name is acceptable to MySQL
	$table = $G['table'];
	$error = (!is_alphanumeric($table)) ? 'use only letters, numbers, or underscores' : '';

	// don't check to see if the table is inserted, just try to insert and check for an error.
	$user = user();
	$table = $user . 'no' . $table;
	mysql_query("CREATE TABLE $table (ID INT NOT NULL AUTO_INCREMENT, UNIQUE KEY(ID))") or die("This table already exists? " . mysql_error());
	header("Location: edit_table.php?domain=$domain&table=$table");
}

html_header("add a table");
?>

<body>

<div id="container">

<?php header_div(); ?>

<div id="body">

<form action="new_table.php" method="get">

<p>table name: <input name="table" /></p>

<p><input type="submit" value="save" /></p>

</form>




<?php echo footer(); ?>

</div>

</div>
</body>
</html>
